//
//  UIButton+HWDUIButton.m
//  huangwdUI
//
//  Created by 张露杰 on 17/4/7.
//  Copyright © 2017年 张露杰. All rights reserved.
//

#import "UIButton+HWDUIButton.h"

@implementation UIButton (HWDUIButton)

+(UIButton *)createButton:(UIButtonType)buttonType frame:(CGRect)cg targ:(id)targe sel:(SEL)sel titleColor:(UIColor *)titleColor font:(UIFont*)font title:(NSString *)title  image:(NSString *)imageName backGroundImage:(NSString*)backImageName
{
    UIButton *button = [UIButton buttonWithType:buttonType];
    button.frame = cg;
    [button setTitle:title forState:UIControlStateNormal];
    [button setTitleColor:titleColor  forState:UIControlStateNormal];
    [button setImage:[[UIImage imageNamed:imageName] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forState:UIControlStateNormal];
    [button setBackgroundImage:[[UIImage imageNamed:backImageName] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forState:UIControlStateNormal];
    button.titleLabel.font = font;
    [button addTarget:targe action:sel forControlEvents:UIControlEventTouchUpInside];
    return button;
}

@end
